package com.web.service.impl;

import com.web.dao.UserDAO;
import com.web.dao.impl.UserDAOImpl;
import com.web.entity.User;
import com.web.service.UserService;

public class UserServiceImpl implements UserService {

    private UserDAO userDAO = new UserDAOImpl();

    @Override
    public User login(String username, String password) {
        //通过用户名查用户
        User user = userDAO.selectUserByUsername(username);

        //验证存在与密码
        if(user!=null){
            if(password.equals(user.getPassword())){
                return user;
            }
        }
        return null;
    }
}
